Add deployable Computer MCP example - #28
Conversation
commit: |
6b8cd20 to
be031a6
Compare
be031a6 to
c6048e3
Compare
c6048e3 to
f1cf132
Compare
c6048e3 to
509bf0d
Compare
|
Trying to figure out if we need this on top of the existing backend. I'm not sure what it would be used for. What are your thoughts? |
509bf0d to
b2e6e91
Compare
5cb656e to
652d3bd
Compare
aron-cf
left a comment
There was a problem hiding this comment.
Looking good, left some early comments.
|
Hey @agent-think can you deploy a version of this MCP server example, then can you: (1) do some light smoke testing of file based workflows. |
652d3bd to
d58edb0
Compare
|
b6b728d to
53d2750
Compare
3e37b7c to
cf739d1
Compare
c3a8329 to
d97a33e
Compare
d97a33e to
a6a5621
Compare
a6a5621 to
d2a7d0d
Compare
Computer already provides durable filesystem and command tools, but the repository did not show how to expose them through a remote MCP server. This adds
examples/mcp, a deployable single-user example built with@cloudflare/codemode.MCP clients see one public
codetool. Code Mode turns the internal Computer tools intocodemode.read,codemode.ls,codemode.write,codemode.edit, andcodemode.execfunctions that the model can combine in one call. The workspace belongs to one durable object, so files persist between MCP requests.worker-shellis the fast default and has no ambient outbound network access, though its built-in Git command supports HTTPS remotes. A model can selectcontainer-shellwhen it needs Debian, Node.js, npm, native binaries, or package downloads. The container starts on demand, and Computer synchronizes/workspacethrough its FUSE mount. Code Mode itself runs in an isolated Dynamic Worker without outbound network access.For example, the model can use the public
codetool to run:The MCP endpoint requires a bearer token and fails closed until
MCP_TOKENis configured. To deploy from a clone and set the secret:Clients connect to
https://<worker>.workers.dev/mcpover Streamable HTTP and sendAuthorization: Bearer <MCP_TOKEN>. The README also covers the Deploy to Cloudflare button, client configuration, backend selection, local development, debugging, and the single-user security model.The workerd integration test connects a real MCP client, verifies authentication and the one-tool interface, exercises filesystem and Worker-shell operations, checks persistence, and confirms that Code Mode cannot reach the network directly. Type checking, repository checks, and the Wrangler deployment dry-run also pass.